/*
 * uart.h
 *
 *  Created on: Jul 11, 2021
 *      Author: 本地账户
 */

#ifndef INC_UART_H_
#define INC_UART_H_

#include "sys.h"
#include "stdio.h"
#include "stm32f4xx_hal_uart.h"




#define USART_REC_LEN  			200  	//定义最大接收字节数 200
#define EN_USART1_RX 			1		//使能（1）/禁止（0）串口1接收
#define EN_USART2_RX 			1		//使能（1）/禁止（0）串口1接收
#define EN_UART4_RX 			1		//使能（1）/禁止（0）串口1接收
#define EN_UART5_RX 			1		//使能（1）/禁止（0）串口1接收



extern u8  USART1_RX_BUF[USART_REC_LEN]; //接收缓冲,最大USART_REC_LEN个字节.末字节为换行符
extern u8  USART2_RX_BUF[USART_REC_LEN];
extern u8  USART3_RX_BUF[USART_REC_LEN];
extern u8  UART4_RX_BUF[USART_REC_LEN];
extern u8  UART5_RX_BUF[USART_REC_LEN];

extern u16 USART1_RX_STA;    //接收状态标记
extern u16 USART2_RX_STA;
extern u16 USART3_RX_STA;
extern u16 UART4_RX_STA;
extern u16 UART5_RX_STA;

extern UART_HandleTypeDef huart1; //UART句柄
extern UART_HandleTypeDef huart2;
extern UART_HandleTypeDef huart3;
extern UART_HandleTypeDef huart4;
extern UART_HandleTypeDef huart5;

#define RXBUFFERSIZE   1 //缓存大小
extern u8 aRxBuffer1[RXBUFFERSIZE];//HAL库USART接收Buffer
extern u8 aRxBuffer2[RXBUFFERSIZE];
extern u8 aRxBuffer3[RXBUFFERSIZE];
extern u8 aRxBuffer4[RXBUFFERSIZE];
extern u8 aRxBuffer5[RXBUFFERSIZE];


//如果想串口中断接收，请不要注释以下宏定义


#endif /* INC_UART_H_ */
